#if MLN_RENDER_BACKEND_OPENGL

#include <mbgl/test/util.hpp>

#include <mbgl/platform/gl_functions.hpp>

using namespace mbgl::platform;

TEST(GLFunctions, OpenGLES) {
    /* OpenGL ES 2.0 */

    EXPECT_NE(glActiveTexture, nullptr);
    EXPECT_NE(glAttachShader, nullptr);
    EXPECT_NE(glBindAttribLocation, nullptr);
    EXPECT_NE(glBindBuffer, nullptr);
    EXPECT_NE(glBindFramebuffer, nullptr);
    EXPECT_NE(glBindRenderbuffer, nullptr);
    EXPECT_NE(glBindTexture, nullptr);
    EXPECT_NE(glBlendColor, nullptr);
    EXPECT_NE(glBlendEquation, nullptr);
    EXPECT_NE(glBlendEquationSeparate, nullptr);
    EXPECT_NE(glBlendFunc, nullptr);
    EXPECT_NE(glBlendFuncSeparate, nullptr);
    EXPECT_NE(glBufferData, nullptr);
    EXPECT_NE(glBufferSubData, nullptr);
    EXPECT_NE(glCheckFramebufferStatus, nullptr);
    EXPECT_NE(glClear, nullptr);
    EXPECT_NE(glClearColor, nullptr);
    EXPECT_NE(glClearDepthf, nullptr);
    EXPECT_NE(glClearStencil, nullptr);
    EXPECT_NE(glColorMask, nullptr);
    EXPECT_NE(glCompileShader, nullptr);
    EXPECT_NE(glCompressedTexImage2D, nullptr);
    EXPECT_NE(glCompressedTexSubImage2D, nullptr);
    EXPECT_NE(glCopyTexImage2D, nullptr);
    EXPECT_NE(glCopyTexSubImage2D, nullptr);
    EXPECT_NE(glCreateProgram, nullptr);
    EXPECT_NE(glCreateShader, nullptr);
    EXPECT_NE(glCullFace, nullptr);
    EXPECT_NE(glDeleteBuffers, nullptr);
    EXPECT_NE(glDeleteFramebuffers, nullptr);
    EXPECT_NE(glDeleteProgram, nullptr);
    EXPECT_NE(glDeleteRenderbuffers, nullptr);
    EXPECT_NE(glDeleteShader, nullptr);
    EXPECT_NE(glDeleteTextures, nullptr);
    EXPECT_NE(glDepthFunc, nullptr);
    EXPECT_NE(glDepthMask, nullptr);
    EXPECT_NE(glDepthRangef, nullptr);
    EXPECT_NE(glDetachShader, nullptr);
    EXPECT_NE(glDisable, nullptr);
    EXPECT_NE(glDisableVertexAttribArray, nullptr);
    EXPECT_NE(glDrawArrays, nullptr);
    EXPECT_NE(glDrawElements, nullptr);
    EXPECT_NE(glEnable, nullptr);
    EXPECT_NE(glEnableVertexAttribArray, nullptr);
    EXPECT_NE(glFinish, nullptr);
    EXPECT_NE(glFlush, nullptr);
    EXPECT_NE(glFramebufferRenderbuffer, nullptr);
    EXPECT_NE(glFramebufferTexture2D, nullptr);
    EXPECT_NE(glFrontFace, nullptr);
    EXPECT_NE(glGenBuffers, nullptr);
    EXPECT_NE(glGenerateMipmap, nullptr);
    EXPECT_NE(glGenFramebuffers, nullptr);
    EXPECT_NE(glGenRenderbuffers, nullptr);
    EXPECT_NE(glGenTextures, nullptr);
    EXPECT_NE(glGetActiveAttrib, nullptr);
    EXPECT_NE(glGetActiveUniform, nullptr);
    EXPECT_NE(glGetAttachedShaders, nullptr);
    EXPECT_NE(glGetAttribLocation, nullptr);
    EXPECT_NE(glGetBooleanv, nullptr);
    EXPECT_NE(glGetBufferParameteriv, nullptr);
    EXPECT_NE(glGetError, nullptr);
    EXPECT_NE(glGetFloatv, nullptr);
    EXPECT_NE(glGetFramebufferAttachmentParameteriv, nullptr);
    EXPECT_NE(glGetIntegerv, nullptr);
    EXPECT_NE(glGetProgramInfoLog, nullptr);
    EXPECT_NE(glGetProgramiv, nullptr);
    EXPECT_NE(glGetRenderbufferParameteriv, nullptr);
    EXPECT_NE(glGetShaderInfoLog, nullptr);
    EXPECT_NE(glGetShaderiv, nullptr);
    EXPECT_NE(glGetShaderPrecisionFormat, nullptr);
    EXPECT_NE(glGetShaderSource, nullptr);
    EXPECT_NE(glGetString, nullptr);
    EXPECT_NE(glGetTexParameterfv, nullptr);
    EXPECT_NE(glGetTexParameteriv, nullptr);
    EXPECT_NE(glGetUniformfv, nullptr);
    EXPECT_NE(glGetUniformiv, nullptr);
    EXPECT_NE(glGetUniformLocation, nullptr);
    EXPECT_NE(glGetVertexAttribfv, nullptr);
    EXPECT_NE(glGetVertexAttribiv, nullptr);
    EXPECT_NE(glGetVertexAttribPointerv, nullptr);
    EXPECT_NE(glHint, nullptr);
    EXPECT_NE(glIsBuffer, nullptr);
    EXPECT_NE(glIsEnabled, nullptr);
    EXPECT_NE(glIsFramebuffer, nullptr);
    EXPECT_NE(glIsProgram, nullptr);
    EXPECT_NE(glIsRenderbuffer, nullptr);
    EXPECT_NE(glIsShader, nullptr);
    EXPECT_NE(glIsTexture, nullptr);
    EXPECT_NE(glLineWidth, nullptr);
    EXPECT_NE(glLinkProgram, nullptr);
    EXPECT_NE(glPixelStorei, nullptr);
    EXPECT_NE(glPolygonOffset, nullptr);
    EXPECT_NE(glReadPixels, nullptr);
    EXPECT_NE(glReleaseShaderCompiler, nullptr);
    EXPECT_NE(glRenderbufferStorage, nullptr);
    EXPECT_NE(glSampleCoverage, nullptr);
    EXPECT_NE(glScissor, nullptr);
    EXPECT_NE(glShaderBinary, nullptr);
    EXPECT_NE(glShaderSource, nullptr);
    EXPECT_NE(glStencilFunc, nullptr);
    EXPECT_NE(glStencilFuncSeparate, nullptr);
    EXPECT_NE(glStencilMask, nullptr);
    EXPECT_NE(glStencilMaskSeparate, nullptr);
    EXPECT_NE(glStencilOp, nullptr);
    EXPECT_NE(glStencilOpSeparate, nullptr);
    EXPECT_NE(glTexImage2D, nullptr);
    EXPECT_NE(glTexParameterf, nullptr);
    EXPECT_NE(glTexParameterfv, nullptr);
    EXPECT_NE(glTexParameteri, nullptr);
    EXPECT_NE(glTexParameteriv, nullptr);
    EXPECT_NE(glTexSubImage2D, nullptr);
    EXPECT_NE(glUniform1f, nullptr);
    EXPECT_NE(glUniform1fv, nullptr);
    EXPECT_NE(glUniform1i, nullptr);
    EXPECT_NE(glUniform1iv, nullptr);
    EXPECT_NE(glUniform2f, nullptr);
    EXPECT_NE(glUniform2fv, nullptr);
    EXPECT_NE(glUniform2i, nullptr);
    EXPECT_NE(glUniform2iv, nullptr);
    EXPECT_NE(glUniform3f, nullptr);
    EXPECT_NE(glUniform3fv, nullptr);
    EXPECT_NE(glUniform3i, nullptr);
    EXPECT_NE(glUniform3iv, nullptr);
    EXPECT_NE(glUniform4f, nullptr);
    EXPECT_NE(glUniform4fv, nullptr);
    EXPECT_NE(glUniform4i, nullptr);
    EXPECT_NE(glUniform4iv, nullptr);
    EXPECT_NE(glUniformMatrix2fv, nullptr);
    EXPECT_NE(glUniformMatrix3fv, nullptr);
    EXPECT_NE(glUniformMatrix4fv, nullptr);
    EXPECT_NE(glUseProgram, nullptr);
    EXPECT_NE(glValidateProgram, nullptr);
    EXPECT_NE(glVertexAttrib1f, nullptr);
    EXPECT_NE(glVertexAttrib1fv, nullptr);
    EXPECT_NE(glVertexAttrib2f, nullptr);
    EXPECT_NE(glVertexAttrib2fv, nullptr);
    EXPECT_NE(glVertexAttrib3f, nullptr);
    EXPECT_NE(glVertexAttrib3fv, nullptr);
    EXPECT_NE(glVertexAttrib4f, nullptr);
    EXPECT_NE(glVertexAttrib4fv, nullptr);
    EXPECT_NE(glVertexAttribPointer, nullptr);
    EXPECT_NE(glViewport, nullptr);

    /* OpenGL ES 3.0 */

    EXPECT_NE(glReadBuffer, nullptr);
    EXPECT_NE(glDrawRangeElements, nullptr);
    EXPECT_NE(glTexImage3D, nullptr);
    EXPECT_NE(glTexSubImage3D, nullptr);
    EXPECT_NE(glCopyTexSubImage3D, nullptr);
    EXPECT_NE(glCompressedTexImage3D, nullptr);
    EXPECT_NE(glCompressedTexSubImage3D, nullptr);
    EXPECT_NE(glGenQueries, nullptr);
    EXPECT_NE(glDeleteQueries, nullptr);
    EXPECT_NE(glIsQuery, nullptr);
    EXPECT_NE(glBeginQuery, nullptr);
    EXPECT_NE(glEndQuery, nullptr);
    EXPECT_NE(glGetQueryiv, nullptr);
    EXPECT_NE(glGetQueryObjectuiv, nullptr);
    EXPECT_NE(glUnmapBuffer, nullptr);
    EXPECT_NE(glGetBufferPointerv, nullptr);
    EXPECT_NE(glDrawBuffers, nullptr);
    EXPECT_NE(glUniformMatrix2x3fv, nullptr);
    EXPECT_NE(glUniformMatrix3x2fv, nullptr);
    EXPECT_NE(glUniformMatrix2x4fv, nullptr);
    EXPECT_NE(glUniformMatrix4x2fv, nullptr);
    EXPECT_NE(glUniformMatrix3x4fv, nullptr);
    EXPECT_NE(glUniformMatrix4x3fv, nullptr);
    EXPECT_NE(glBlitFramebuffer, nullptr);
    EXPECT_NE(glRenderbufferStorageMultisample, nullptr);
    EXPECT_NE(glFramebufferTextureLayer, nullptr);
    EXPECT_NE(glMapBufferRange, nullptr);
    EXPECT_NE(glFlushMappedBufferRange, nullptr);
    EXPECT_NE(glBindVertexArray, nullptr);
    EXPECT_NE(glDeleteVertexArrays, nullptr);
    EXPECT_NE(glGenVertexArrays, nullptr);
    EXPECT_NE(glIsVertexArray, nullptr);
    EXPECT_NE(glGetIntegeri_v, nullptr);
    EXPECT_NE(glBeginTransformFeedback, nullptr);
    EXPECT_NE(glEndTransformFeedback, nullptr);
    EXPECT_NE(glBindBufferRange, nullptr);
    EXPECT_NE(glBindBufferBase, nullptr);
    EXPECT_NE(glTransformFeedbackVaryings, nullptr);
    EXPECT_NE(glGetTransformFeedbackVarying, nullptr);
    EXPECT_NE(glVertexAttribIPointer, nullptr);
    EXPECT_NE(glGetVertexAttribIiv, nullptr);
    EXPECT_NE(glGetVertexAttribIuiv, nullptr);
    EXPECT_NE(glVertexAttribI4i, nullptr);
    EXPECT_NE(glVertexAttribI4ui, nullptr);
    EXPECT_NE(glVertexAttribI4iv, nullptr);
    EXPECT_NE(glVertexAttribI4uiv, nullptr);
    EXPECT_NE(glGetUniformuiv, nullptr);
    EXPECT_NE(glGetFragDataLocation, nullptr);
    EXPECT_NE(glUniform1ui, nullptr);
    EXPECT_NE(glUniform2ui, nullptr);
    EXPECT_NE(glUniform3ui, nullptr);
    EXPECT_NE(glUniform4ui, nullptr);
    EXPECT_NE(glUniform1uiv, nullptr);
    EXPECT_NE(glUniform2uiv, nullptr);
    EXPECT_NE(glUniform3uiv, nullptr);
    EXPECT_NE(glUniform4uiv, nullptr);
    EXPECT_NE(glClearBufferiv, nullptr);
    EXPECT_NE(glClearBufferuiv, nullptr);
    EXPECT_NE(glClearBufferfv, nullptr);
    EXPECT_NE(glClearBufferfi, nullptr);
    EXPECT_NE(glGetStringi, nullptr);
    EXPECT_NE(glCopyBufferSubData, nullptr);
    EXPECT_NE(glGetUniformIndices, nullptr);
    EXPECT_NE(glGetActiveUniformsiv, nullptr);
    EXPECT_NE(glGetUniformBlockIndex, nullptr);
    EXPECT_NE(glGetActiveUniformBlockiv, nullptr);
    EXPECT_NE(glGetActiveUniformBlockName, nullptr);
    EXPECT_NE(glUniformBlockBinding, nullptr);
    EXPECT_NE(glDrawArraysInstanced, nullptr);
    EXPECT_NE(glDrawElementsInstanced, nullptr);
    EXPECT_NE(glFenceSync, nullptr);
    EXPECT_NE(glIsSync, nullptr);
    EXPECT_NE(glDeleteSync, nullptr);
    EXPECT_NE(glClientWaitSync, nullptr);
    EXPECT_NE(glWaitSync, nullptr);
    EXPECT_NE(glGetInteger64v, nullptr);
    EXPECT_NE(glGetSynciv, nullptr);
    EXPECT_NE(glGetInteger64i_v, nullptr);
    EXPECT_NE(glGetBufferParameteri64v, nullptr);
    EXPECT_NE(glGenSamplers, nullptr);
    EXPECT_NE(glDeleteSamplers, nullptr);
    EXPECT_NE(glIsSampler, nullptr);
    EXPECT_NE(glBindSampler, nullptr);
    EXPECT_NE(glSamplerParameteri, nullptr);
    EXPECT_NE(glSamplerParameteriv, nullptr);
    EXPECT_NE(glSamplerParameterf, nullptr);
    EXPECT_NE(glSamplerParameterfv, nullptr);
    EXPECT_NE(glGetSamplerParameteriv, nullptr);
    EXPECT_NE(glGetSamplerParameterfv, nullptr);
    EXPECT_NE(glVertexAttribDivisor, nullptr);
    EXPECT_NE(glBindTransformFeedback, nullptr);
    EXPECT_NE(glDeleteTransformFeedbacks, nullptr);
    EXPECT_NE(glGenTransformFeedbacks, nullptr);
    EXPECT_NE(glIsTransformFeedback, nullptr);
    EXPECT_NE(glPauseTransformFeedback, nullptr);
    EXPECT_NE(glResumeTransformFeedback, nullptr);
    EXPECT_NE(glGetProgramBinary, nullptr);
    EXPECT_NE(glProgramBinary, nullptr);
    EXPECT_NE(glProgramParameteri, nullptr);
    EXPECT_NE(glInvalidateFramebuffer, nullptr);
    EXPECT_NE(glInvalidateSubFramebuffer, nullptr);
    EXPECT_NE(glTexStorage2D, nullptr);
    EXPECT_NE(glTexStorage3D, nullptr);
    EXPECT_NE(glGetInternalformativ, nullptr);
}

#endif
